<?php
/**
 * Copyright (c) 2006-2008, Julien PORTALIER
 * http://featherphp.googlecode.com/
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 */

/**
 * Exports an array into an INI file.
 */
function write_ini_file($file, array $arr)
{
	if ($fh = fopen($file, 'w'))
	{
		foreach($arr as $k => $v)
		{
			if (is_array($v))
			{
				fwrite($fh, "[$k]\n");
				foreach($arr[$k] as $k => $v)
					fwrite($fh, "$k=$v\n");
				fwrite($fh, "\n");
			}
			else {
				fwrite($fh, "$k=$v\n");
			}
		}
		return true;
	}
	return false;
}
?>